package cn.ultrarisk.scadmin.manager.biz.stat.entity;

import cn.ultrarisk.scadmin.manager.biz.stat.context.StatType;
import cn.ultrarisk.mybatis.extension.annotation.Table;

import java.io.Serializable;
import java.util.LinkedHashMap;
import java.util.Map;


/**
 * solr副本统计实体类
 *
 * @author sevendlong(lin23871@163.com)
 * @date 2014/4/14
 * @since V1.0
 */
@Table(table = "solr_replica_stat", idColumn = SolrReplicaStat.ID, autoIncrement = true)
public class SolrReplicaStat implements Serializable {
    private static final long serialVersionUID = -4048157538324024657L;

    public final static String ID = "id";
    public final static String NODE_ID = "node_id";
    public final static String COLLECTION_ID = "collection_id";
    public final static String SHARD_ID = "shard_id";
    public final static String REPLICA_ID = "replica_id";
    public final static String TYPE = "type";
    public final static String AVG_QPS = "avg_qps";
    public final static String MAX_QPS = "max_qps";
    public final static String VISIT_COUNT = "visit_count";
    public final static String DOCS = "docs";
    public final static String HITS = "hits";
    public final static String STATE = "state";
    public final static String LEADER_STATE = "leader_state";
    public final static String ACTIVE_STATE = "active_state";
    public final static String RECOVERING_STATE = "recovering_state";
    public final static String DOWN_STATE = "down_state";
    public final static String RECOVER_FAILED_STATE = "recover_failed_state";
    public final static String GONE_STATE = "gone_state";
    public final static String START_TIME = "start_time";
    public final static String END_TIME = "end_time";

    public static final Map<String, String> COLUMN_PROPERTY_MAP = new LinkedHashMap<String, String>();

    static {
        COLUMN_PROPERTY_MAP.put(ID, "id");
        COLUMN_PROPERTY_MAP.put(NODE_ID, "nodeId");
        COLUMN_PROPERTY_MAP.put(COLLECTION_ID, "collectionId");
        COLUMN_PROPERTY_MAP.put(SHARD_ID, "shardId");
        COLUMN_PROPERTY_MAP.put(REPLICA_ID, "replicaId");
        COLUMN_PROPERTY_MAP.put(TYPE, "type");
        COLUMN_PROPERTY_MAP.put(AVG_QPS, "avgQps");
        COLUMN_PROPERTY_MAP.put(MAX_QPS, "maxQps");
        COLUMN_PROPERTY_MAP.put(VISIT_COUNT, "visitCount");
        COLUMN_PROPERTY_MAP.put(DOCS, "docs");
        COLUMN_PROPERTY_MAP.put(HITS, "hits");
        COLUMN_PROPERTY_MAP.put(STATE, "state");
        COLUMN_PROPERTY_MAP.put(LEADER_STATE, "leaderState");
        COLUMN_PROPERTY_MAP.put(ACTIVE_STATE, "activeState");
        COLUMN_PROPERTY_MAP.put(RECOVERING_STATE, "recoveringState");
        COLUMN_PROPERTY_MAP.put(DOWN_STATE, "downState");
        COLUMN_PROPERTY_MAP.put(RECOVER_FAILED_STATE, "recoverFailedState");
        COLUMN_PROPERTY_MAP.put(GONE_STATE, "goneState");
        COLUMN_PROPERTY_MAP.put(START_TIME, "startTime");
        COLUMN_PROPERTY_MAP.put(END_TIME, "endTime");
    }

    /**
     * id
     */
    private Long id;
    /**
     * 节点id
     */
    private Integer nodeId;
    /**
     * 集合id
     */
    private Integer collectionId;
    /**
     * 分片id
     */
    private Integer shardId;
    /**
     * 副本id
     */
    private Integer replicaId;
    /**
     * 统计类型
     */
    private StatType type;
    /**
     * 平均qps值
     */
    private Double avgQps;
    /**
     * 最大qps值
     */
    private Double maxQps;
    /**
     * 访问次数
     */
    private Long visitCount;
    /**
     * 文档数
     */
    private Long docs;
    /**
     * 缓存命中率
     */
    private Double hits;
    /**
     * 所有状态
     */
    private Integer state;
    /**
     * leader状态
     */
    private Integer leaderState;
    /**
     * active状态
     */
    private Integer activeState;
    /**
     * recovering状态
     */
    private Integer recoveringState;
    /**
     * down状态
     */
    private Integer downState;
    /**
     * recoverFailed状态
     */
    private Integer recoverFailedState;
    /**
     * gone状态
     */
    private Integer goneState;
    /**
     * 统计开始时间
     */
    private Long startTime;
    /**
     * 统计结束时间
     */
    private Long endTime;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Integer getNodeId() {
        return nodeId;
    }

    public void setNodeId(Integer nodeId) {
        this.nodeId = nodeId;
    }

    public Integer getCollectionId() {
        return collectionId;
    }

    public void setCollectionId(Integer collectionId) {
        this.collectionId = collectionId;
    }

    public Integer getShardId() {
        return shardId;
    }

    public void setShardId(Integer shardId) {
        this.shardId = shardId;
    }

    public Integer getReplicaId() {
        return replicaId;
    }

    public void setReplicaId(Integer replicaId) {
        this.replicaId = replicaId;
    }

    public StatType getType() {
        return type;
    }

    public void setType(StatType type) {
        this.type = type;
    }

    public Double getMaxQps() {
        return maxQps;
    }

    public void setMaxQps(Double maxQps) {
        this.maxQps = maxQps;
    }

    public Double getAvgQps() {
        return avgQps;
    }

    public void setAvgQps(Double avgQps) {
        this.avgQps = avgQps;
    }

    public Long getVisitCount() {
        return visitCount;
    }

    public void setVisitCount(Long visitCount) {
        this.visitCount = visitCount;
    }

    public Long getDocs() {
        return docs;
    }

    public void setDocs(Long docs) {
        this.docs = docs;
    }

    public Double getHits() {
        return hits;
    }

    public void setHits(Double hits) {
        this.hits = hits;
    }

    public Integer getState() {
        return state;
    }

    public void setState(Integer state) {
        this.state = state;
    }

    public Integer getLeaderState() {
        return leaderState;
    }

    public void setLeaderState(Integer leaderState) {
        this.leaderState = leaderState;
    }

    public Integer getActiveState() {
        return activeState;
    }

    public void setActiveState(Integer activeState) {
        this.activeState = activeState;
    }

    public Integer getRecoveringState() {
        return recoveringState;
    }

    public void setRecoveringState(Integer recoveringState) {
        this.recoveringState = recoveringState;
    }

    public Integer getDownState() {
        return downState;
    }

    public void setDownState(Integer downState) {
        this.downState = downState;
    }

    public Integer getRecoverFailedState() {
        return recoverFailedState;
    }

    public void setRecoverFailedState(Integer recoverFailedState) {
        this.recoverFailedState = recoverFailedState;
    }

    public Integer getGoneState() {
        return goneState;
    }

    public void setGoneState(Integer goneState) {
        this.goneState = goneState;
    }

    public Long getStartTime() {
        return startTime;
    }

    public void setStartTime(Long startTime) {
        this.startTime = startTime;
    }

    public Long getEndTime() {
        return endTime;
    }

    public void setEndTime(Long endTime) {
        this.endTime = endTime;
    }
}